cap cd $root
global root "`c(pwd)'"
global output "${root}\tables\\"
global codes "${root}\function_calls\\"
global data "${root}\data\\"
global workdir "${root}\data\temp\" 
cd $workdir
set scheme s1mono

global ProgReInstall "Yes" // Yes or No 
global PrepReDo "Yes" // Yes or No, recreates final datasets in $workdir
global simData "Yes" // Yes or No, defines relevance of some controls and specs

if "${ProgReInst}"=="Yes" {
ssc install winsor
ssc install winsor2
ssc install egenmore
ssc install estout
ssc install mahapick
}
//////////////////////////////////////////////////////////////////////////////////
if "${PrepReDo}"=="Yes" {
//step(1)
**this code recreates the matched dataset for postselection regressions 
global inputFile "post_select_sim.csv"
do "${codes}match4postselA.do"
}
////////////////////////////////////////////////////////////////////////////////





///////////////////////////// Tables 5,6 //////////////////////////////////////

**Table 5. Selection hazard model
global inputFile "hazard_sim.csv"
do "${codes}Table5output.do"

**Table 6. Post selection analyses
do "${codes}Table6output.do"






